import {Modal, notification} from "ant-design-vue";

export default {

    okNotify(msg, position = 'top-right') {
        notification.success({
            message: msg,
            type: 'success',
            duration: 1.5,
            position
        })
    },

    warningNotify(msg, position = 'top-right') {
        notification.warn({
            message: msg,
            type: 'warning',
            duration: 1.5,
            position
        })
    },

    errorNotify(msg, position = 'top-right') {
        notification.error({
            message: msg,
            type: 'error',
            duration: 1.5,
            position
        })
    },

    notify(msg, position = 'top-right') {
        notification.info({
            message: msg,
            type: 'info',
            duration: 1.5,
            position
        })
    },

    confirm(content) {
        return new Promise((resolve,reject) => {
            Modal.confirm({
                title: '系统提示',
                content: content,
                okText: '确定',
                cancelText: '取消',
                type: 'warning',
                onOk(){
                    resolve(true)
                },
                onCancel(){
                    reject(false)
                }
            })
        })
    }
}
